package com.homedo.microservice.open.service.gateway.manager.web.autoconfig;

import com.fasterxml.jackson.databind.DeserializationFeature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.homedo.microservice.open.service.gateway.manager.web.support.DynamicCodeCompiler;
import com.homedo.microservice.open.service.gateway.manager.web.support.GroovyCompiler;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class AutoConfig {
    @Bean
    public ObjectMapper objectMapper() {
        ObjectMapper objectMapper = new ObjectMapper();
//        objectMapper.configure(JsonParser.Feature.IGNORE_UNDEFINED, true);
        objectMapper.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
        objectMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);

        return objectMapper;
    }


//    @Bean
//    public DynamicCodeCompiler dynamicCodeCompiler() {
//        return new GroovyCompiler();
//    }
}
